﻿Imports Microsoft.VisualBasic

'CLASE PROBADA Y TESTEADA


Public Class Carta : Implements IComparable
    'identificador de la carta
    Private id As String
    Private nombre As String
    Private descripcion As String

    Public Sub New(ByVal idCarta As String, ByVal nombreCarta As String, ByVal descripcionCarta As String)
        id = idCarta
        nombre = nombreCarta
        descripcion = descripcionCarta
    End Sub

    Public Property pID() As String
        Get
            Return id
        End Get
        Set(ByVal value As String)
            id = value
        End Set
    End Property

    Public Property pNombre() As String
        Get
            Return nombre
        End Get
        Set(ByVal value As String)
            nombre = value
        End Set
    End Property

    Public Property pDescripcion() As String
        Get
            Return descripcion
        End Get
        Set(ByVal value As String)
            descripcion = value
        End Set
    End Property

    Public Overloads Function compareTo(ByVal o As Object) As Integer Implements IComparable.CompareTo
        If TypeOf o Is Carta Then
            Dim c As Carta = CType(o, Carta)
            Return pID().CompareTo(c.pID())
        End If

        Throw New ArgumentException("El objeto pasado no es de tipo Carta")
    End Function







End Class
